{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1324
  Verdict: Accepted
}
type str = array[0..1000010] of char;
var s:ansistring; c:str; i,ls:longint; z:array[0..1000010] of longint; ch:char;
procedure ZF(s:str);
var l,r,i,j,k:longint;
begin
z[0]:=ls;
l:=0;
r:=0;
k:=ls-1;
write(ls,' ');
for i:=1 to k do begin
	if z[i-l]+i<=r then z[i]:=z[i-l] else begin
		l:=i;
		if i>r then r:=i;
		z[i]:=r-i;
		while r<ls do begin
      if s[r]<>s[z[i]] then break;
			inc(r);
			inc(z[i]);
		end;
		dec(r);
	end;
	write(z[i],' ');
end;	
end;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
fillchar(z,sizeof(z),0);
ls:=0;
read(ch);
while ch in ['a'..'z'] do begin
	c[ls]:=ch;
	inc(ls);
	read(ch);
end;
zf(c);
end.